package com.samsung.spen.sshare.networking.sendreceivefile;

import java.io.File;
import java.util.ArrayList;

import com.samsung.spen.sshare.explorer.util.FileExtend;

public class SubFileExtend extends FileExtend{

	private String mFileName;
	private String mFileSize;
	private int mIndex;
	public int percent=0;
	
	public SubFileExtend(String file) {
		super(file);
	}
	
	public SubFileExtend(File f) {
		super(f);
	}
	
	
	public SubFileExtend(String name, String size) {
		super(name);
		this.mFileName=name;
		this.mFileSize=size;
	}

	public String getFileName() {
		return super.getFile().getName();
	}

	public String getFileSize() {
		return mFileSize;
	}

	public int getIndex() {
		return mIndex;
	}

	public void setIndex(int mIndex) {
		this.mIndex = mIndex;
	}	
	
	public static ArrayList<SubFileExtend> parseFiles(String data){
		ArrayList<SubFileExtend> result=new ArrayList<SubFileExtend>();
		String[] fileSets = data.split(";");
		for (String fileSet : fileSets) {
			String fileName = fileSet.split(",")[0];
			String fileSize = fileSet.split(",")[1];
			SubFileExtend file = new SubFileExtend(fileName, fileSize);
			result.add(file);
		}
		
		return result;
	}
}
